import request from '@/utils/request'
import apis from '@/api/index'

export function onCompletionAdviser (username) {
  return request({
    url: `${apis.AutoCompletionAdviser}?username=${username}`,
    method: 'get'
  })
}

/**
 * 待领取业务
 * @param parameter
 * @returns {AxiosPromise}
 */
export function getPatentData (parameter) {
  return request({
    url: apis.UnclaimedList,
    method: 'get',
    params: parameter
  })
}

/**
 * 领取业务
 * @param parameter
 * @returns {AxiosPromise}
 */
export function getReceive (parameter) {
  return request({
    url: apis.ReceiveList,
    method: 'get',
    params: parameter
  })
}

export function getFlow (id) {
  return request({
    url: `${apis.GetFlow}?cb_id=${id}`,
    method: 'get'
  })
}

export function postFlow (id, data) {
  return request({
    url: `${apis.GetFlow}?cb_id=${id}`,
    method: 'post',
    data: data
  })
}

/**
 * 材料整理列表
 * @param parameter
 * @returns {AxiosPromise}
 */
export function getArrangeList (parameter) {
  return request({
    url: apis.ArrangeList,
    method: 'get',
    params: parameter
  })
}

/**
 * 获取历史信息
 * @param id
 * @returns {AxiosPromise}
 */
export function getHistoryList (id) {
  return request({
    url: `${apis.HistoryList}?cb_id=${id}`,
    method: 'get'
  })
}

export function getArrangeEditStatus (id) {
  return request({
    url: `${apis.EditStatus}?cb_id=${id}`,
    method: 'get'
  })
}

export function postArrangeEditStatus (id, data) {
  return request({
    url: `${apis.EditStatus}?cb_id=${id}`,
    method: 'post',
    data: data
  })
}

export function getOfficialEditStatus (id) {
  return request({
    url: `${apis.OfficialEditStatus}?cb_id=${id}`,
    method: 'get'
  })
}

export function postOfficialEditStatus (id, data) {
  return request({
    url: `${apis.OfficialEditStatus}?cb_id=${id}`,
    method: 'post',
    data: data
  })
}

export function getOfficialEditStatus3 (id) {
  return request({
    url: `${apis.OfficialEditStatus3}?cb_id=${id}`,
    method: 'get'
  })
}

export function postOfficialEditStatus3 (id, data) {
  return request({
    url: `${apis.OfficialEditStatus3}?cb_id=${id}`,
    method: 'post',
    data: data
  })
}

export function getPatent () {
  return request({
    url: apis.GetPatent,
    method: 'get'
  })
}

export function appointPatent (id, data) {
  return request({
    url: `${apis.GetPatent}?cb_id=${id}`,
    method: 'post',
    data: data
  })
}

/**
 * 下载
 * @param id
 * @returns {AxiosPromise}
 */
export function getArrangeDownload (id) {
  return request({
    url: `${apis.ArrangeDownload}?cb_id=${id}`,
    method: 'get'
  })
}

/**
 * 上传
 * @param id
 * @returns {AxiosPromise}
 */
export function getArrangeUpload (id) {
  return request({
    url: `${apis.ArrangeUpload}?cb_id=${id}`,
    method: 'get'
  })
}

export function postArrangeUpload (id, data) {
  return request({
    url: `${apis.ArrangeUpload}?cb_id=${id}`,
    method: 'post',
    data: data
  })
}

export function getProcessDetail (id) {
  return request({
    url: `${apis.ProcessDetail}?cb_id=${id}`,
    method: 'get'
  })
}

export function postProcessDetail (id, data) {
  return request({
    url: `${apis.ProcessDetail}?cb_id=${id}`,
    method: 'post',
    data: data
  })
}

export function getProcessDetail2 (id) {
  return request({
    url: `${apis.ProcessDetail2}?cb_id=${id}`,
    method: 'get'
  })
}

export function postProcessDetail2 (id, data) {
  return request({
    url: `${apis.ProcessDetail2}?cb_id=${id}`,
    method: 'post',
    data: data
  })
}

/**
 * 提交官方列表
 * @param parameter
 * @returns {AxiosPromise}
 */
export function getGovernment (parameter) {
  return request({
    url: apis.GovernmentList,
    method: 'get',
    params: parameter
  })
}

/**
 * 信息采集列表
 * @param parameter
 * @returns {AxiosPromise}
 */
export function getGather (parameter) {
  return request({
    url: apis.GatherList,
    method: 'get',
    params: parameter
  })
}

/**
 * 获取专利下业务分类
 * @returns {AxiosPromise}
 */
export function getBusinessName () {
  return request({
    url: `${apis.GatherList}?category_id=20`,
    method: 'get'
  })
}

/**
 * 根据业务ID获取官方状态
 * @param id
 * @returns {AxiosPromise}
 */
export function getState (id) {
  return request({
    url: `${apis.GatherList}?business_id=${id}`,
    method: 'get'
  })
}

/**
 * 下载压缩包
 */
export function getDownloadZip (id) {
  return request({
    url: `${apis.CommonDownload}?cb_id=${id}`,
    method: 'get'
  })
}

export function getReceiptHistory (id) {
  return request({
    url: `${apis.ReceiptHistory}?cb_id=${id}`,
    method: 'get'
  })
}
//
// export function getReceiptList (id) {
//   return request({
//     url: `${apis.getReceipt}?cb_id=${id}`,
//     method: 'get'
//   })
// }

export function getReceiptList (id) {
  return request({
    url: `${apis.getReceipt2}?cb_id=${id}`,
    method: 'get'
  })
}

export function postReceiptList (id, data) {
  return request({
    url: `${apis.getReceipt2}?cb_id=${id}`,
    method: 'post',
    data: data
  })
}

export function getEditZlNo (id) {
  return request({
    url: `${apis.editZlNo}?cb_id=${id}`,
    method: 'get'
  })
}

export function postEditZlNo (id, data) {
  return request({
    url: `${apis.editZlNo}?cb_id=${id}`,
    method: 'post',
    data: data
  })
}

export function delState (id) {
  return request({
    url: `${apis.DelInfoState}?cbs_id=${id}`,
    method: 'get'
  })
}

export function getCaseList (parameter) {
  return request({
    url: apis.CaseList,
    method: 'get',
    params: parameter
  })
}

export function getCaseCount (tab) {
  return request({
    url: `${apis.CaseList}?type=${tab}`,
    method: 'get'
  })
}

export function getCaseUpload (id) {
  return request({
    url: `${apis.CaseUpload}?cb_id=${id}`,
    method: 'get'
  })
}

export function postCaseUpload (id, data) {
  return request({
    url: `${apis.CaseUpload}?cb_id=${id}`,
    method: 'post',
    data: data
  })
}

export function getCaseStatus (id) {
  return request({
    url: `${apis.CaseStatus}?cb_id=${id}`,
    method: 'get'
  })
}

export function postCaseStatus (id, data) {
  return request({
    url: `${apis.CaseStatus}?cb_id=${id}`,
    method: 'post',
    data: data
  })
}

export function addTaskTime (cid, time) {
  return request({
    url: `${apis.AddTaskTime}?cb_id=${cid}&time=${time}`,
    method: 'get'
  })
}

export function getPatentMember (parameter) {
  return request({
    url: apis.PatentMember,
    method: 'get',
    params: parameter
  })
}

export function getAdd () {
  return request({
    url: apis.AddPatentMember,
    method: 'get'
  })
}

export function postAdd (data) {
  return request({
    url: apis.AddPatentMember,
    method: 'post',
    data: data
  })
}

export function getEdit (uid) {
  return request({
    url: `${apis.EditPatentMember}?uid=${uid}`,
    method: 'get'
  })
}

export function postEdit (uid, data) {
  return request({
    url: `${apis.EditPatentMember}?uid=${uid}`,
    method: 'post',
    data: data
  })
}

export function delPatentMember (uid) {
  return request({
    url: `${apis.DelPatentMember}?uid=${uid}`,
    method: 'post'
  })
}

export function updateTime (id) {
  return request({
    url: `${apis.OnTime2}?cb_id=${id}`,
    method: 'get'
  })
}

export function batchDownload (id) {
  return request({
    url: `${apis.BatchDownload}?cb_id=${id}`,
    method: 'get'
  })
}

export function getLabel (parameter) {
  return request({
    url: apis.GetLabel,
    method: 'get',
    params: parameter
  })
}

export function addLabel (data) {
  return request({
    url: apis.AddLabel,
    method: 'post',
    data: data
  })
}

export function delLabel (id) {
  return request({
    url: `${apis.DelLabel}?id=${id}`,
    method: 'post'
  })
}

export function getEditLabel (id) {
  return request({
    url: `${apis.EditLabel}?cb_id=${id}`,
    method: 'get'
  })
}

export function postEditLabel (id, data) {
  return request({
    url: `${apis.EditLabel}?cb_id=${id}`,
    method: 'post',
    data: data
  })
}

export function getNatural (parameter) {
  return request({
    url: apis.QualList,
    method: 'get',
    params: parameter
  })
}

export function addCompany (data) {
  return request({
    url: apis.AddNatural,
    method: 'post',
    data: data
  })
}

export function getPatentAdd (id) {
  return request({
    url: `${apis.AddPatent}?id=${id}`,
    method: 'get'
  })
}

export function postPatentAdd (id, data) {
  return request({
    url: `${apis.AddPatent}?id=${id}`,
    method: 'post',
    data: data
  })
}

export function getOption (id) {
  return request({
    url: `${apis.PatentOption}?id=${id}`,
    method: 'get'
  })
}

export function getScheduleTask (parameter) {
  return request({
    url: apis.ScheduleTask,
    method: 'get',
    params: parameter
  })
}

export function getAddSchedule (id) {
  return request({
    url: `${apis.AddSchedule}?cb_id=${id}`,
    method: 'get'
  })
}

export function postAddSchedule (id, data) {
  return request({
    url: `${apis.AddSchedule}?cb_id=${id}`,
    method: 'post',
    data: data
  })
}

export function getPatentByCompany (id) {
  return request({
    url: `${apis.GetPatentByCompany}?qid=${id}`,
    method: 'get'
  })
}

export function getUpdateName (id) {
  return request({
    url: `${apis.UpdateName}?cb_id=${id}`,
    method: 'get'
  })
}

export function postUpdateName (id, data) {
  return request({
    url: `${apis.UpdateName}?cb_id=${id}`,
    method: 'post',
    data: data
  })
}

export function getImport () {
  return request({
    url: apis.ImportReceiptPt,
    method: 'get'
  })
}

export function getImportByState (id) {
  return request({
    url: `${apis.ImportReceiptPt}?business_id=${id}`,
    method: 'get'
  })
}

export function postImport (data) {
  return request({
    url: apis.ImportReceiptPt,
    method: 'post',
    data: data
  })
}

export function getLost (parameter) {
  return request({
    url: apis.LostReceiptPt,
    method: 'get',
    params: parameter
  })
}

export function getState2 (parameter) {
  return request({
    url: apis.StateList5,
    method: 'get',
    params: parameter
  })
}

export function getState3 (parameter) {
  return request({
    url: apis.EditState5,
    method: 'get',
    params: parameter
  })
}

export function getState4 (parameter) {
  return request({
    url: `${apis.StateList5}?type=100`,
    method: 'get',
    params: parameter
  })
}

export function postState4 (parameter, data) {
  return request({
    url: apis.EditState5,
    method: 'post',
    params: parameter,
    data: data
  })
}
